package com.sgj.common.enums;

import com.sgj.common.utils.EnumsTrans;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: Guoji Shen
 * @Date: 2021/12/17 9:18
 */
@AllArgsConstructor
public enum UserNameEnum implements EnumsTrans<UserNameEnum> {
    NAME_ONE(1, "xiaoshen"),
    NAME_TWO(2, "xiaobai");

    @Getter
    private Integer code;

    @Getter
    private String message;

    // 枚举类字段转换
    @Override
    public String enumConveter(UserNameEnum enums){
        for (UserNameEnum userNameEnum : UserNameEnum.values()){
            if (userNameEnum.equals(enums)){
                return enums.getMessage();
            }
        }
        return null;
    }
}